<template>
  <div>
    <el-table border v-table-fit :data="result" @row-dblclick="rowDbClick" v-loading="loading">
      <el-table-column label="选择" width="50" align="center" v-if="allowCheck ==='1'">
        <template slot-scope="scope">
          <el-radio v-model="checkModel.strProp" :label="scope.row">{{ "" }}</el-radio>
        </template>
      </el-table-column>
      <el-table-column sortable v-for="(column, index) in tableFields" :key="index" :prop="column.prop" :label="column.label">
      </el-table-column>
    </el-table>
    <el-button v-if="allowCheck === '1' " style="margin-top: 10px" @click="returnItem">确定</el-button>
  </div>
</template>

<script>
export default {
  name: "index",
  props: {
    tableFields: Array,
    result: Array,
    allowCheck: String,
    searchTerm: '',
    index: String,
    allowdbclick: String,
    loading: Boolean,
  },
  data() {
    return {
      checkModel: {
        strProp: '',
        get str() {
          return this.strProp;
        }
      },
    }
  },
  methods: {
    returnItem() {
      this.$emit('send', this.checkModel.strProp[this.index])
      this.$emit('close');
    },
    rowDbClick(row, column) {
      this.$emit('rowDbClick', row)
    }

  }
}
</script>

<style scoped>
.a {
  overflow-y: scroll;
}
</style>
